package com.jgy.spring.bean.eventandlistener;

import com.jgy.StudyApplication;
import com.jgy.spring.bean.eventandlistener.Customer1;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

/**
 * @author 姜光远
 * @date 2023/3/21 10:17
 */
@Component
public class Customer2 {
    @EventListener(Customer1.class)
    public void onApplicationEvent(Customer1 customer1) throws InterruptedException {
        System.out.println("监听器接受消息：解耦成功，开始执行解耦业务");
        System.out.println(customer1.getUser());
    }

}
